<?php
/**
 * QQAS - share your knowledge to the world!
 *
 * @author		xiaochong0302 <xiaochong0302@gmail.com>
 * @copyright	Copyright (c) 2011, Koogua Studio.
 * @license		http://www.qqas.org/user_guide/license.html
 * @link		http://www.qqas.org
 * @since		Version 1.0
 * @filesource
 */


class QuestionFollowModel extends Model
{

	
	/**
	 * 检查关注问题数是否超出限制('ture' => '超出', 'false' => '未超出')
	 *
	 * @param int $userID
	 * @param int $userGroup
	 * @return  bool 
	 */
	public function checkFollowLimit($userID, $userGroup)
	{
		$userGroup = F('cache_usergroup_'. $userGroup);
        $map = array('user_id' => $userID);
        $followCount = $this->where($map)->count();
        return ($followCount >= $userGroup['max_question_follow']) ? false : true;
	}
	
}


/* End of file QuestionFollowModel.class.php */
/* Location: ./App/Lib/Model/QuestionFollowModel.class.php */